<template>
	<view class="setingMenu">
		<view class="menu_list_box">
			<view class="menu_item" v-for="item in setingMenu" :key="item.name" @tap="goLink(item)">
				<view class="fn-sz-32 fn-cl-333333">{{ item.name }}</view>
				<image class="icon-30" src="../../static/images/icon/icon_moer_btn.png"></image>
			</view>
		</view>
		<view class="login_out_btn"><button @tap="loginOut">退出登录</button></view>
		<u-modal :show="logoutShow" :content="content" @cancel="logoutShow = false" @confirm="confirmLogout" :showCancelButton="true" confirmColor="#FED100"></u-modal>
	</view>
</template>

<script>
export default {
	data() {
		return {
			setingMenu: [{ name: '支付密码', url: '/pages/mine/changePassword' }, { name: '意见反馈', url: '/pages/mine/messageReturn' }, { name: '注销账号' }],
			logoutShow: false,
			content: '当前操作会注销账号，请警惕使用！'
		};
	},
	methods: {
		goLink({ url, name }) {
			if (url) {
				uni.navigateTo({
					url
				});
			} else {
				console.log(url, 'sss');
				switch (name) {
					case '注销账号':
						this.logoutShow = true;
						break;
				}
			}
		},
		confirmLogout() {
			this.$api.delMember().then(res => {
				if (res.code == 1) {
					uni.clearStorageSync();
					uni.switchTab({
						url: '/pages/shop/shop'
					});
				}
			});
		},
		loginOut() {
			uni.clearStorageSync();
			uni.switchTab({
				url: '/pages/shop/shop'
			});
		}
	}
};
</script>

<style lang="scss">
.setingMenu {
	min-height: 100vh;
	background-color: #ffffff;
	box-sizing: border-box;
	padding: 0 24rpx;
	.menu_list_box {
		margin-bottom: 300rpx;
		.menu_item {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 27rpx 0;
			border-bottom: 2rpx solid #eeeeee;
		}
	}
	.login_out_btn {
		button {
			height: 90rpx;
			background: #ffffff;
			border-radius: 45rpx;
			border: 2rpx solid #cccccc;
			font-size: 30rpx;
			text-align: center;
			line-height: 90rpx;
		}
	}
}
</style>
